//
//  VESaveMoneyTableViewCell.m
//  VEMoneyPorject
//
//  Created by BlueWind on 2018/9/30.
//  Copyright © 2018 陈建. All rights reserved.
//

#import "VESaveMoneyTableViewCell.h"

@implementation VESaveMoneyTableViewCell

/** 返回循环利用的cell */
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self= [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self loadDefaultSetting];
    }
    return self;
}

/** 加载默认UI元素和需要的数据 */
- (void)loadDefaultSetting {
    
    self.titleName = [UILabel new];
    [self.contentView addSubview:self.titleName];
    [self.titleName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView);
        make.left.equalTo(self.contentView).offset(GAP15);
        make.width.mas_equalTo(70);
    }];
    self.titleName.textColor = [UIColor colorWithHexString:kDetailTextBlackColor];
    self.titleName.font = kFont(16);
    self.titleName.text = @"存储金额:";
    
    
    self.enterText = [[BRTextField alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH-60, 40)];
    [self.contentView addSubview:self.enterText];
    [self.enterText mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.edges.mas_equalTo(UIEdgeInsetsMake(GAP8, GAP15, 0, GAP15));
        make.centerY.equalTo(self.contentView);
        make.left.equalTo(self.titleName.mas_right).offset(GAP8);
        make.height.mas_equalTo(35);
        make.right.equalTo(self.contentView).offset(-GAP15);
    }];
    self.enterText.textAlignment = NSTextAlignmentLeft;
    self.enterText.font = kFont(16);
    self.enterText.textColor = [UIColor colorWithHexString:kDetailTextGrayBlackColor];
    [self.enterText layerBorderWithWidth:0.5 borderColor:[UIColor colorWithHexString:kDetailTextGrayBlackColor]];
    self.enterText.layerCornerRadius = 6;
    
    UIView *leftView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 12, 0)];
    leftView.backgroundColor = [UIColor whiteColor];
    self.enterText.leftView = leftView;
    self.enterText.leftViewMode = UITextFieldViewModeAlways;
    
    
    UIImageView *jiantou = [UIImageView new];
    jiantou.userInteractionEnabled = NO;
    _jiantou = jiantou;
    [self.enterText addSubview:jiantou];
    [jiantou mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.enterText);
        make.right.equalTo(self.enterText.mas_right).offset(-GAP8);
        make.size.mas_equalTo(CGSizeMake(18, 18));
    }];
    jiantou.image = IMG(@"上拉");
}

@end
